﻿using System;
using System.Collections.Generic;
using System.Windows.Forms;
using Data.Common;
using Data.Enum;
using Data.ViewModel;
using DataAccess.BikeManage.logical;

namespace WinForm.UserManage
{
    public partial class FrmCheckCardConsume : Form
    {
        public FrmCheckCardConsume()
        {
            InitializeComponent();
        }

        public FrmCheckCardConsume(string cardNo)
        {
            InitializeComponent();
            lbcardno.Text = cardNo;
        }

        private void FrmCheckCardConsume_Load(object sender, EventArgs e)
        {
            Zq58Logical zq58Logical = new Zq58Logical();
            List<ConsumeView> views =new List<ConsumeView>();
            for (int i = 1; i < 21; i++)
            {
                try
                {
                    ResultInfo<DealRecord> deal = zq58Logical.GetDealRecords(i);
                    if (deal.ResultNumber == ResultEnum.Success && deal.Obj != null && (Converts.ConvertToInt(deal.Obj.DealTime.Substring(0, 4)) > 1990) && (Converts.ConvertToInt(deal.Obj.DealTime.Substring(0, 4)) <2030))
                    {
                        views.Add(new ConsumeView() { Serial = i, ConsumeMoney = deal.Obj.DealMoney.ToString(), ConsumeTime = deal.Obj.DealTime, CpuId = deal.Obj.CpuId, LockAddress = deal.Obj.TerminalId });
                    }
                }
                catch (Exception)
                {

                }
            }
            dgvUserComsume.DataSource = views;
        }
    }
}
